package service.cart;

import dao.CartDAO;
import dao.RecordDuplicateException;
import entities.Cart;


public class CartServiceInMemory implements CartService {

	public CartServiceInMemory(){
		
	}
	
	public static CartService newInstance(){
		return new CartServiceInMemory();
	}
	
	/**
	 * Finds a customer based on the customer id.
	 * @param userid - user id
	 * @return the instance of the customer
	 */
	public Cart findCart(String title){
		CartDAO db = CartDAO.getInstance();
		Cart result = null;
		result = db.findCart(title);
		return result;
	}
	
	
	/**
	 * Adds a new customer to the system.
	 * @param obj - the customer instance to add
	 */
	
	public void addCart(Cart obj) throws RecordDuplicateException{
		CartDAO db = CartDAO.getInstance();	
		db.addCart(obj);
		return;
	}

}
